package com.myfoon.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "LOCATION")
public class Location implements Serializable {
    private Long id;
    private User owner;
    private String name;
    private Float latitude;
    private Float longitude;
    private String streetaddress;
    private String region;
    private String city;
    private String country;    
    
    public Location() {
    }

    public Location(String name, Float latitude, Float longitude,
                    String streetaddress, String region, String city,
                    String country) {
        super();
        this.name = name;
        this.latitude = latitude;
        this.longitude = longitude;
        this.streetaddress = streetaddress;
        this.region = region;
        this.city = city;
        this.country = country;
    }

    public void setId(Long id) {
        this.id = id;
    }
    
    @Id 
    @GeneratedValue(generator = "LocationSequence", strategy = GenerationType.AUTO)
    @SequenceGenerator(name = "LocationSequence", allocationSize = 1, sequenceName = "LOCATION_SEQ_01")
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    public void setOwner(User owner) {
        this.owner = owner;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "OWNER")
    public User getOwner() {
        return owner;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    @Column(name = "NAME")
    public String getName() {
        return name;
    }
    
    public void setLatitude(Float latitude) {
        this.latitude = latitude;
    }

    @Column(name = "LATITUDE")
    public Float getLatitude() {
        return latitude;
    }

    public void setLongitude(Float longitude) {
        this.longitude = longitude;
    }

    @Column(name = "LONGITUDE")
    public Float getLongitude() {
        return longitude;
    }
    
    public void setStreetaddress(String streetaddress) {
        this.streetaddress = streetaddress;
    }

    @Column(name = "STREETADDRESS")
    public String getStreetaddress() {
        return streetaddress;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    @Column(name = "REGION")
    public String getRegion() {
        return region;
    }

    public void setCity(String city) {
        this.city = city;
    }

    @Column(name = "CITY")
    public String getCity() {
        return city;
    }

    public void setCountry(String country) {
        this.country = country;
    }
    
    @Column(name = "COUNTRY")
    public String getCountry() {
        return country;
    }
}
